import 'package:flutter/material.dart';
import 'constants.dart';

/// 应用主题配置
class AppThemes {
  // 私有构造函数
  AppThemes._();
  
  /// 亮色主题
  static ThemeData get lightTheme {
    return ThemeData(
      useMaterial3: true,
      colorScheme: ColorScheme.fromSeed(
        seedColor: AppConstants.primaryColor,
        brightness: Brightness.light,
      ),
      
      // 应用栏主题
      appBarTheme: const AppBarTheme(
        elevation: 0,
        centerTitle: true,
        backgroundColor: AppConstants.primaryColor,
        foregroundColor: Colors.white,
        titleTextStyle: TextStyle(
          fontSize: 20,
          fontWeight: FontWeight.bold,
          color: Colors.white,
        ),
      ),
      
      // 卡片主题 - 修复类型错误
      cardTheme: const CardThemeData(
        elevation: 4,
        shape: RoundedRectangleBorder(
          borderRadius: AppConstants.defaultBorderRadius,
        ),
        color: AppConstants.surfaceColor,
      ),
      
      // 按钮主题
      elevatedButtonTheme: ElevatedButtonThemeData(
        style: ElevatedButton.styleFrom(
          elevation: 2,
          padding: AppConstants.defaultPadding,
          shape: const RoundedRectangleBorder(
            borderRadius: AppConstants.defaultBorderRadius,
          ),
          textStyle: const TextStyle(
            fontSize: 16,
            fontWeight: FontWeight.w600,
          ),
        ),
      ),
      
      // 输入框主题
      inputDecorationTheme: InputDecorationTheme(
        filled: true,
        fillColor: Colors.grey.shade100,
        border: const OutlineInputBorder(
          borderRadius: AppConstants.defaultBorderRadius,
          borderSide: BorderSide.none,
        ),
        focusedBorder: const OutlineInputBorder(
          borderRadius: AppConstants.defaultBorderRadius,
          borderSide: BorderSide(
            color: AppConstants.primaryColor,
            width: 2,
          ),
        ),
      ),
      
      // 文本主题
      textTheme: const TextTheme(
        headlineLarge: TextStyle(
          fontSize: 32,
          fontWeight: FontWeight.bold,
          color: AppConstants.onSurfaceColor,
        ),
        headlineMedium: TextStyle(
          fontSize: 28,
          fontWeight: FontWeight.bold,
          color: AppConstants.onSurfaceColor,
        ),
        headlineSmall: TextStyle(
          fontSize: 24,
          fontWeight: FontWeight.w600,
          color: AppConstants.onSurfaceColor,
        ),
        bodyLarge: TextStyle(
          fontSize: 16,
          color: AppConstants.onSurfaceColor,
        ),
        bodyMedium: TextStyle(
          fontSize: 14,
          color: AppConstants.onSurfaceColor,
        ),
        labelLarge: TextStyle(
          fontSize: 16,
          fontWeight: FontWeight.w600,
          color: AppConstants.onSurfaceColor,
        ),
      ),
    );
  }
  
  /// 暗色主题
  static ThemeData get darkTheme {
    return ThemeData(
      useMaterial3: true,
      colorScheme: ColorScheme.fromSeed(
        seedColor: AppConstants.primaryColor,
        brightness: Brightness.dark,
      ),
      
      appBarTheme: const AppBarTheme(
        elevation: 0,
        centerTitle: true,
        backgroundColor: AppConstants.primaryColorDark,
        foregroundColor: Colors.white,
        titleTextStyle: TextStyle(
          fontSize: 20,
          fontWeight: FontWeight.bold,
          color: Colors.white,
        ),
      ),
      
      cardTheme: CardThemeData(
        elevation: 4,
        shape: const RoundedRectangleBorder(
          borderRadius: AppConstants.defaultBorderRadius,
        ),
        color: Colors.grey.shade800,
      ),
      
      elevatedButtonTheme: ElevatedButtonThemeData(
        style: ElevatedButton.styleFrom(
          elevation: 2,
          padding: AppConstants.defaultPadding,
          shape: const RoundedRectangleBorder(
            borderRadius: AppConstants.defaultBorderRadius,
          ),
          textStyle: const TextStyle(
            fontSize: 16,
            fontWeight: FontWeight.w600,
          ),
        ),
      ),
    );
  }
}

/// 游戏特定颜色 - 移出AppThemes类
class GameColors {
  static const Color puzzleBoardBackground = Color(0xFFF8F9FA);
  static const Color puzzlePieceBorder = Color(0xFFDEE2E6);
  static const Color puzzlePieceSelected = Color(0xFF007BFF);
  static const Color puzzlePiecePlaced = Color(0xFF28A745);
  static const Color scatterAreaBackground = Color(0xFFE9ECEF);
  
  // 拖拽状态颜色
  static const Color dragFeedbackBorder = Color(0xFF17A2B8);
  static const Color dropTargetHighlight = Color(0xFF20C997);
  static const Color dropTargetAccept = Color(0xFF28A745);
  static const Color dropTargetReject = Color(0xFFDC3545);
}

/// 动画曲线 - 移出AppThemes类
class AnimationCurves {
  static const Curve defaultCurve = Curves.easeInOut;
  static const Curve bounceCurve = Curves.bounceOut;
  static const Curve snapCurve = Curves.elasticOut;
  static const Curve completionCurve = Curves.elasticInOut;
}
